package com.itheima.controller;

import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckGroup;
import com.itheima.service.CheckgroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/checkgroup")
public class CheckgroupController {

    @Autowired
    private CheckgroupService checkgroupService;

    @PostMapping("/findPage.do")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return checkgroupService.findPage(queryPageBean);
    }


    @PostMapping("/add.do")
    public Result add(Integer [] checkitemIds ,@RequestBody CheckGroup checkGroup ){
        return checkgroupService.add(checkitemIds,checkGroup);
    }


    @GetMapping("/findById.do")
    public Result findById(Integer id){
        return checkgroupService.findById(id);
    }

    @GetMapping("/findCheckItemIdsByCheckGroupId.do")
    public Result findCheckItemIdsByCheckGroupId(Integer id){
        return checkgroupService.findCheckItemIdsByCheckGroupId(id);
    }

    @PostMapping("/edit.do")
    public Result edit(Integer [] checkitemIds ,@RequestBody CheckGroup checkGroup ){
        return checkgroupService.edit(checkitemIds,checkGroup);
    }

    @GetMapping("/findAll.do")
    public Result findAll(){
        return checkgroupService.findAll();
    }


}
